<?php
if (!defined('libs')) {
    header('Location: ../404error.php');
}$plantilla = new controladorPlantillas();
?>    
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="administrador/plantilla/css/base.css" type="text/css" />
        <link href='http://fonts.googleapis.com/css?family=Rosario:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
        <?php
        if (isset($_GET['accion'])) {
            if ($_GET['accion'] == 'editandoPagina' || $_GET['accion'] == 'editandoNuevaPagina' || $_GET['accion'] == 'editandoCarro' || $_GET['accion'] == 'editandoNuevoCarro') {
                ?>

                <script type="text/javascript" src="http://www.google.com/jsapi"></script>
                <script type="text/javascript">
                    google.load("jquery", "1.3");
                </script>
                <script type="text/javascript" src="administrador/plantilla/tiny_mce/tiny_mce.js"></script>
                <script type="text/javascript">
                    i=0;
                    j=0;
                    function addElement2(){
                        var capa2 = document.getElementById("capa2");
                        var h1 = document.createElement("input");
                        var h2 = document.createElement("br");
                        var h3i = document.createElement("span");
                        var sep = document.createElement("br");
                        var h3 = document.createElement("input");
                        var h4i = document.createElement("span");
                      
                        
                        h3i.innerHTML = 'Título: ';
                        h4i.innerHTML = 'Valor: ';
                        h1.name =  "titulo_esp"+j;
                        h1.type = "text";
                        h3.name =  "valor_esp"+j;
                        h3.type = "text";
                     
                        document.getElementById("nEsp").value = j;
                                   
                        capa2.appendChild(h3i);   
                        capa2.appendChild(h1);      
                        capa2.appendChild(sep);
                        capa2.appendChild(h4i);
                        capa2.appendChild(h3);
                        capa2.appendChild(h2);
                        
                                                                
                        j++; 
                    }
                    function addElement(){
                        //i=0;
                        var capa = document.getElementById("capa");
                        var h1 = document.createElement("input");
                        var h2 = document.createElement("br");
                        var h3i = document.createElement("span");
                        var sep = document.createElement("br");
                        var h3 = document.createElement("input");
                        var MinP = document.createElement("input");
                        var h4i = document.createElement("span");
                        var sep2 = document.createElement("br");
                        var sep3 = document.createElement("br");
                        var h4 = document.createElement("input");
                        var sep4 = document.createElement("br");
                        // var hInd = document.createElement("input");
                        //  h1.id = "_custom"+i;
                        h1.name =  "fotografia_"+i;
                        h1.type = "file";
                                                                                       
                        //= "text";

                        h3i.innerHTML = 'Título de la fotografia: ';
                        h4i.innerHTML = 'Descripción: ';
                        h3.name =  "titulo_foto"+i;
                        h3.type = "text";
                        h3.setAttribute("class", "text");

                        MinP.type = "hidden";
                        MinP.name = "gPrincipal";
                        if(i==0){
                            MinP.value = "1";
                        }else{
                            MinP.value = "0";        
                        }
                        h4.name =  "descripcion"+i;
                        h4.id = "a"+i;
                        h4.type = "text";
                        h4.setAttribute("class", "text");
                        document.getElementById("hInd").value = i;
                        capa.appendChild(h1);
                        capa.appendChild(h2);
                        capa.appendChild(h3i);
                        capa.appendChild(sep);
                        capa.appendChild(h3);
                        capa.appendChild(sep2);
                        capa.appendChild(h4i);
                        capa.appendChild(sep3);        
                        capa.appendChild(MinP);
                        capa.appendChild(h4);
                        capa.appendChild(sep4);
                        //tinyMCE.execCommand('mceAddControl', false, 'a'+i);
                        i++;
                        //toggleEditor("a"+i);
                    }

                                                                                            

                    tinyMCE.init({
                        // General options
                        // elements : "texto",                
                        mode : "textareas",
                        theme : "advanced",
                        plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
                        // Theme options
                        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
                        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
                        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
                        theme_advanced_toolbar_location : "top",
                        theme_advanced_toolbar_align : "left",
                        theme_advanced_statusbar_location : "bottom",
                        theme_advanced_resizing : true,
                        // Example content CSS (should be your site CSS)
                        content_css : "css/example.css",
                        // Drop lists for link/image/media/template dialogs
                        template_external_list_url : "js/template_list.js",
                        external_link_list_url : "js/link_list.js",
                        external_image_list_url : "js/image_list.js",
                        media_external_list_url : "js/media_list.js",
                        // Replace values for the template plugin
                        template_replace_values : {
                            username : "Some User",
                            staffid : "991234"
                        }
                    });
                </script>
                <?php
            }
        }
        ?>
    </head>
    <body>
        <div>
            <div class="menuSuperior">
                <div class="contMenuSuperior">
                    <a href="indexAdmin.php">Gestor de contenidos Golden Age</a><br />
                    <a href="index.php" target="_blank">Ir a la página Golden Age</a>
                    <div style="text-align: right"><a href="?accion=logOut">Log Out</a></div>
                </div>
            </div>
            <div class="contenido">
                <?php
                echo $plantilla->plantillaOutput();
                ?>    
            </div>
        </div>
    </body>
</html>